/**
 * @author akaovi
 * @version 1.0
 * @description
 * @date 2022/11/29 21:21
 * @since 2022/11/29 21:21
 */
public class One {
    /**
     * 1、输入任意一个5位数，将其各位数字反序输出，并判定所有数字和的奇偶
     * （例如输入12345，则输出54321，数字和为奇）。
     */
    public static void reverseOrder() {
        // 获取数字
        int num;
        int[] nums = new int[5];
        while (true) {
            try {
                System.out.print("请输入一个五位数: ");
               num = Utils.getOneInteger();
               if (num < 10000) {
                   throw new RuntimeException();
               }
                for (int i = 0; i < 5; i++) {
                    nums[i] = num % 10;
                    num /= 10;
                }
                if (num != 0) {
                    throw new RuntimeException();
                }
               break;
            } catch (Exception e) {}
        }
        int count = 0;
        for (int i = 0; i < nums.length; i++) {
            System.out.print(nums[i]);
            count += nums[i];
        }
        if (count % 2 != 0) {
            System.out.println();
            System.out.println("数字和为奇数");
        } else {
            System.out.println();
            System.out.println("数字和为偶数");
        }
    }

    public static void main(String[] args) {
        One.reverseOrder();
    }
}
